<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 美妆课堂模块
 * 
 * @author  : $Author: spike $
 * @date    : $Date: 2014-03-11 09:50:31 +0800 (二, 2014-03-11) $
 * @version : $Id: beauty.php 70 2014-03-11 01:50:31Z spike $
 * @rev     : $Revision: 70 $
 */
class Beauty extends MY_Controller 
{
	public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
    	$params = $this->input->get();

        $this->load->dao('Beauty_dao');
        $list = $this->Beauty_dao->get(
            array(
                'status'    => BEAUTY_STATUS_ON,
                'is_delete' => UNDELETED,
            ),
            array('beauty_id','title','cover_img'),
            '`create_time` DESC'
        );

    	$data = array(
            'list'       => $list,
            'current_url'=> DOMAIN.'beauty',
        );

        $this->load->view('home/header.tpl', $data);
        $this->load->view('beauty/index.tpl');
        $this->load->view('home/footer.tpl');
    }

    public function view($beauty_id = NULL)
    {
        $this->load->model('Beauty_model');
        if( ! $beauty = $this->Beauty_model->get_beauty($beauty_id, TRUE, TRUE))
        {
            show_error("无法找到美妆课堂。");
        }

        $data  = array(
            'beauty'     => $beauty,
            'current_url'=> DOMAIN.'beauty',
        );

        $this->load->view('home/header.tpl', $data);
        $this->load->view('beauty/view.tpl');
        $this->load->view('home/footer.tpl');
    }
}